package org.example.controller;

import jakarta.annotation.Resource;
import org.example.service.IOrdersService;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author TonySong
 * @date 2024/5/15 0015
 * @time 10:48
 */
@RestController
@RequestMapping("/order")
public class OrderController {

    @Resource
    private IOrdersService ordersService;


    @GetMapping("/pay/{uid}/{bid}")
    public Boolean pay(@PathVariable("uid") Long uid,@PathVariable("bid") Long bid) {
        //根据图书编号查询图书
        //判断图书的库存是否充足
        //扣减库存
        //创建订单
        return ordersService.createOrder(uid, bid);
    }



}
